# -*- coding: utf-8 -*-
# __author__ : Ricky
# __createTime__ : 2022/1/23 19:11
# __fileName__ : py apiTest.py
# __devIDE__ : PyCharm
import time
import requests
import json
HOST = "http://localhost:8088"

def sendMsg(path, data, prefix='send_msg'):
    """
    测试用例，具体api查看 /op/*
    """
    url = f"{HOST}/{prefix}/{path}"
    res = requests.post(url, json=data).json()
    print(json.dumps(res, ensure_ascii=False, indent=4))

def sendNotice():
    data = {'from_name': '守护天堂', 'to_wxid': '23114933559@chatroom', 'type': '1', 'timestamp': '1642962265', 'event': 'SendOutMsg', 'original_content': '31', 'content': '1', 'msg': '1', 'msgid': '1744645673', 'msg_type': '1', 'from_wxid': 'wxid_dyj8lg3du5lj22', 'robot_wxid': 'wxid_dyj8lg3du5lj22', 'send_out_scene': '0', 'send_out_type': '0', 'to_name': '测试开发', 'final_from_wxid': 'wxid_dyj8lg3du5lj22', 'final_from_name': '守护天堂'}
    res = requests.post("http://localhost/api/robot/notice", json=data).json()
    print(json.dumps(res, ensure_ascii=False, indent=4))

if __name__ == '__main__':
    start = time.time()
    data = {
        "robot_wxid": "wxid_dyj8",
        "to_wxid": "wxid_7cy9",
        "msg": "hello"
    }
    sendMsg("text", data)
    # sendNotice()
    print(f"耗时:{time.time()-start}")












